package com.ymatou.ics.api.testcase;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.ics.api.parameter.GetAddressListBean;
import com.ymatou.ics.api.service.GetAddressListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.utils.JsonBeanHelper;
/**
*GetAddressList
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetAddressList{
//	private static GetAddressListBean getaddresslistBean;
	private static GetAddressListCall getaddresslistCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("GetAddressList");
	}

	@Before
	public void caseUp() {
//		getaddresslistBean=new GetAddressListBean();
		getaddresslistCall=new GetAddressListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getaddresslistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void TC_GetAddressList_001() {
		Logger.start(true,"获取官方收货地址");
		try {
			//TODO 补全case代码
					
			Map<String, Object> map = new HashMap<String, Object>();		
			map.put("UserId",3383);			    
			map.put("OrderId","105308340");
			
			//调用接口json文件
			JSONObject createreturnapplybill =  JsonBeanHelper.getJsonBean("/com.ymatou.ics.api.agreeapply/GetAddressList/GetAddressListTpl.json");
			createreturnapplybill = JsonBeanHelper.updateJsonBean(createreturnapplybill, map); 		
			JSONObject result = getaddresslistCall.callAndGetReturnData(createreturnapplybill);	
			
			String Code = result.getString("Code");
			Logger.verifyIsContains(Code, 200, "\"Code\":200");
			
			String BCode = result.getString("BCode");
			Logger.verifyIsContains(BCode, 0, "\"Code\":0");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}